admin: Write out correct version fields in boot/loader/entries files
authorColin Walters <walters@verbum.org>
Wed, 21 Aug 2013 22:48:00 +0000 (18:48 -0400)
committerColin Walters <walters@verbum.org>
Thu, 22 Aug 2013 09:46:11 +0000 (05:46 -0400)
commit8abad0b45218ca580dc5df2aaea687bc47e50210
tree47331f6bf75ecedb0ce3591b46db4f038d668768
parent7e2e072ad41a96e9669aa16fc72ed87592bcea3e
admin: Write out correct version fields in boot/loader/entries files

Before, we were writing the "bootversion", which is either 0 or 1, for
all entries.  This is completely wrong; the idea of the "version"
field is to compare between entries.

Fix this by writing out the inverted index - internally, index 0 is
the *first* boot entry, so we give it the highest version number, and
index N is the last, so give it version 0.

Then fix the deployment sorting code to correctly reverse the version
number comparison, so we read back the right order.

In practice before this bug didn't matter because "normally" you only
have at most two deployments.

https://bugzilla.gnome.org/show_bug.cgi?id=706546
src/ostree/ot-admin-deploy.c
src/ostree/ot-admin-functions.c
tests/test-admin-deploy-1.sh